package com.bonjour.work.controller.api;

import com.alibaba.fastjson.JSONObject;
import com.bonjour.common.core.BaseRest;
import com.bonjour.common.core.RpcReply;
import com.bonjour.common.view.parser.RequestSession;
import com.bonjour.work.dto.StandardResume;
import com.bonjour.work.dto.response.UploadFileResponse;
import com.bonjour.work.kern.CodeMSG;
import com.bonjour.work.service.ResumeService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.inject.Inject;
import java.util.List;

@RestController
@RequestMapping("/resume")
public class ResumeController extends BaseRest {
    private final ResumeService resumeService;

    @Inject
    public ResumeController(ResumeService resumeService) {
        this.resumeService = resumeService;
    }

    @GetMapping("/getInfoById")
    public RpcReply<JSONObject> getInfoById(@RequestParam("id")Long rid, RequestSession session) {
        return RpcReply.onOk(resumeService.getInfoById(rid, session.uid));
    }

    @GetMapping("/getInfoByMessage")
    public RpcReply<JSONObject> getInfoByMessage(@RequestBody StandardResume standardResume,RequestSession session) {
        //TODO: decrypt message
        return RpcReply.onOk(resumeService.getInfoByMessage(standardResume, session.uid));
    }

}
